module config.ConfigurationDefine;

import std.random;

class AppKey
{
    string appid;
    string appkey;
}

class GateConfig
{
    string      id;
    string      ipaddr;
    AppKey[]      app;
    string      appurl;
    int         tcpport;
    int         wsport;
    string      log;
    MsgServerConf[] msgserver;
    LogicServerConf[] logicserver;
}

class MsgServerConf
{
    string id;
    string host;
    int port;
}

class LogicServerConf
{
    string id;
    string host;
    int port;
}

class Config
{
    private __gshared Config _instance;
    private GateConfig _conf;

    static Config getInstance()
    {
        if(_instance is null)
        {
            _instance = new Config();
        }
        return _instance;
    }

    public void setConfig(GateConfig conf)
    {
        assert(conf.msgserver.length > 0);
        _conf = conf;
    }

    public GateConfig getConfig()
    {
        return _conf;
    }
}
